<?php
abstract class page
{
	var $getMetaData=array();
	function __construct($chooseCity=true)
	{
		error_reporting(0);
		$_GET['city']='orehovo_zuevo';
		if(file_exists('class/class_login.php'))include('class/class_login.php');
			else include('../class/class_login.php');
		$aLogin=new login();
		$year=date('Y');
		echo ('
<!DOCTYPE html>
<html>
 <head>
 	<title>
 	');
 	$this->title();
 	echo ('
 	</title>
 	<link rel="shortcut icon" type="image/ico" href="images/favicon1.ico" />
    <link rel="stylesheet" type="text/css" href="style/newstyle.css" />
    <link rel="stylesheet" type="text/css" href="style/try.css" />
 	');
 	$this->styles();
 	$this->scripts();
 	if($this->getMetaData=$this->metaData())$this->meta();
 	echo ('
   	<script type="text/javascript" src="jquery/jquery.js">
	</script>
	    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
 </head>
 <body>
	 <div class="docBody">
		<div class="main">
	    		<div class="maincontent">
	  	');
	  	$this->mainContent();
	  	echo ('
	    	</div>
	    	<div class="spacer">
		</div>
		<div class="footer">
	    		<table>
	    			<tr id="footerTr1">
	    				<td id="footerTd1" width="200">

	    				</td>
	    				<td id="footerTd2" width="200">
	    					<a href="about.php?city='.$_GET['city'].'">О сайте</a>
	    				</td>
	    				<td id="footerTd3" width="300">
	    					<a href="messages.php?city='.$_GET['city'].'">Обратная связь</a>
	    				</td>
	    				<td id="footerTd4" width="200">
	    				</td>
	    			</tr>
	    			<tr id="footerTr2">
	    				<td id="footerTd1" width="200">

	    				</td>
	    				<td id="footerTd2" width="200">
	    					<a href="tofirms.php?city='.$_GET['city'].'">Представителям компаний</a>
	    				</td>
	    				<td id="footerTd3" width="300">
	    					<a href="hostbook.php?city='.$_GET['city'].'">Гостевая книга</a>
	    				</td>
	    				<td id="footerTd4" width="250">
	    					PRO-GOROD.COM &copy;2012-'.$year.'
	    				</td>
	    			</tr>
	    			<tr id="footerTr3">
	    				<td id="footerTd1" width="200">

	    				</td>
	    				<td id="footerTd2" width="200">
	    					<a href="adds.php?city='.$_GET['city'].'">Реклама на сайте</a>
	    				</td>
	    			</tr>
	    		</table>
	    	</div>
	</div>

		<div class="l_colomn">
		');
			 	include('includes/rubricator.php');
		echo ('

		</div>

	 </div>

	 <div class="header" align="center">
		<table border="0" width="980">
			<tr valign="top">
				<td width="200">
				');
				if($chooseCity)
				{
					echo ('
					<link rel="stylesheet" type="text/css" href="style/chooseCity.css" />
					<script type="text/javascript" src="scripts/chooseCityn.js">
					</script>
					');
					@include('includes/cities.php');
					//print_r($region);
					if($_GET['city'])$city=$_GET['city'];
					else
					{
						$city="Выберите Город";
					}
					if(!$_GET['city'])$curRegion="Выберите регион";
					else
					{
						foreach($region as $regionKey=>$regionCities)
						{
							if(in_array($city, $regionCities))
							{
								$curRegion=$regionKey;
								break;
							}
						}
					}
					$cityRus=new city_rus_class();
					echo ('
					<div class="chooseCity">
						<div class="region" id="region"><div class="curRegion">'.$curRegion.'</div></div>
						<div class="city" id="firstcity"><div class="curCity">'.$cityRus->city_rus_im($city).'</div></div>
					</div>
					');
				}
				echo ('
				</td>
				<td>
				<br />

		 	<div class="mainLinks"><a href="index.php?city='.$_GET['city'].'">PRO-GOROD.COM</a></div>
		 		</td>
		 		<td>
		 		<br />
		 			<script type="text/javascript" src="scripts/searchSuggest.js">
					</script>
		 			<form name="search" action="search.php" method="get" id="searchForm">
						<input name="search" id="search" type="text" value="'.$_GET['search'].'" placeholder="Поиск" autocomplete="off">
						<input name="city" id="cityHidden" type="hidden" value="'.$_GET['city'].'">
						<input type="submit" value="Поиск">
						<div class="searchRes">
						</div>
					</form>

		 		</td>
		 		<td width="270" align="right">
		 		<br />
		');
			 		$aLogin->showLoginLink();
		echo ('
		 		</td>
			</tr>
		</table>
	</div>


	');
	if($_SESSION['userStatus']=='1')
	{
		$aConnect=new connect('f');
		$newFirmsNum=mysql_num_rows($aConnect->select_all($_GET['city'], "WHERE status='0'"));
		$blockedFirmsNum=mysql_num_rows($aConnect->select_all($_GET['city'], "WHERE status='2'"));
		$aConnect=new connect('malls');
		$newMallsNum=mysql_num_rows($aConnect->select_all($_GET['city'], "WHERE status='0'"));
		$blockedMallsNum=mysql_num_rows($aConnect->select_all($_GET['city'], "WHERE status='2'"));
		echo ('
		<div class="adminMenu">
		|<a href="adminFirmsList.php?city='.$_GET['city'].'&listSort=newFirms">Новые Фирмы ('.$newFirmsNum.')</a>
		|<a href="adminMallsList.php?city='.$_GET['city'].'&listSort=newMalls">Новые Центры ('.$newMallsNum.')</a>
		|<a href="adminFirmsList.php?city='.$_GET['city'].'&listSort=blockedFirms">Блокированные Фирмы ('.$blockedFirmsNum.')</a>
		|<a href="adminMallsList.php?city='.$_GET['city'].'&listSort=blockedMalls">Блокированные Центры ('.$blockedMallsNum.')</a>
 		<div>
 		');
 	}
 	echo ('


<!-- Yandex.Metrika counter -->
<script type="text/javascript">
(function (d, w, c) {
    (w[c] = w[c] || []).push(function() {
        try {
            w.yaCounter25824479 = new Ya.Metrika({id:25824479,
                    webvisor:true,
                    clickmap:true,
                    trackLinks:true,
                    accurateTrackBounce:true});
        } catch(e) { }
    });

    var n = d.getElementsByTagName("script")[0],
        s = d.createElement("script"),
        f = function () { n.parentNode.insertBefore(s, n); };
    s.type = "text/javascript";
    s.async = true;
    s.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//mc.yandex.ru/metrika/watch.js";

    if (w.opera == "[object Opera]") {
        d.addEventListener("DOMContentLoaded", f, false);
    } else { f(); }
})(document, window, "yandex_metrika_callbacks");
</script>
<noscript><div><img src="//mc.yandex.ru/watch/25824479" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter -->
 </body>
</html>
		');
	}
	function metaData()
	{
		return array('NAME'=>array('Robots'=>'NOINDEX,NOFOLLOW'));
	}
	function meta()
 	{
 		foreach($this->getMetaData as $type=>$data)
 		{
	 		foreach($data as $name=>$content)
	 		{
	 			if(!$type=='http-equiv' || !$type=='name')
	 				throw new exception('Параметр один метода metaData может принимать следующие значения: http-equiv, name ');
	 			echo ('
	 			<META '.$type.'="'.$name.'" CONTENT="'.$content.'">
	 			');
	 		}
		}
 	}
	abstract function mainContent();
	abstract function title();
	function styles(){}
 	function scripts(){}
}
?>